package com.sunspring.zdcall.entity;

import lombok.Data;

import java.util.Date;

/**
 * 后台用户登录日志
 * @author wulei
 * @date 2019-01-03
 **/
@Data
public class ZdLoginLog {

    /**
     * 日志id
     */
    private int logId;

    /**
     * 记录时间
     */
    private Date logTime;

    /**
     * 登录用户id
     */
    private Integer logUser;

    /**
     * 登录类型 1-登录 2-退出
     */
    private Integer logType;

    /**
     * 登录id
     */
    private String ip;

    /**
     * 备注
     */
    private String logDescription;

    public ZdLoginLog() {

    }

    private ZdLoginLog(Date logTime, int logUser, String ip, String logDescription,int loginType) {
        this.logTime = logTime;
        this.logUser = logUser;
        this.ip = ip;
        this.logDescription = logDescription;
        this.logType = loginType;
    }

    public static ZdLoginLog login(Date logTime, int logUser, String ip) {
        return new ZdLoginLog(logTime,logUser,ip,"登录成功",1);
    }

    public static ZdLoginLog logout(Date logTime, int logUser, String ip) {
        return new ZdLoginLog(logTime,logUser,ip,"退出成功",2);
    }
}
